//
//  KYCityWeatherVC-UI.swift
//  ZhiYunWeather
//
//  Created by Wade on 2024/7/10.
//

import Foundation
import UIKit
import QMUIKit
extension KEMainVC{
    func setupSubViews(){
        let header = UIView()
        self.view.addSubview(header)
        header.backgroundColor = .clear
        header.snp.makeConstraints { make in
            make.top.equalTo(self.view.safeAreaLayoutGuide.snp.top)
            make.right.equalTo(self.view)
            make.left.equalTo(self.view)
            make.height.equalTo(44)
        }
        
        let listView = UIView()
        header.addSubview(listView)
        header.backgroundColor = .clear
        listView.snp.makeConstraints { make in
            make.top.bottom.equalTo(header)
            make.left.equalTo(header).offset(10)
            make.width.equalTo(280)
        }
        
        let locationImage = UIImageView()
        locationImage.image = UIImage(named: "icon")
        listView.addSubview(locationImage)
        locationImage.layer.cornerRadius = 20
        locationImage.clipsToBounds = true
        locationImage.contentMode = .scaleAspectFit
        locationImage.snp.makeConstraints { make in
            make.centerY.equalTo(listView)
            make.width.height.equalTo(40)
            make.left.equalTo(listView).offset(5)
        }
        
        
        let locationBtn = UIButton()
        
        listView.addSubview(locationBtn)
        locationBtn.snp.makeConstraints { make in
            make.top.bottom.equalTo(listView)
            make.width.equalTo(100)
            make.left.equalTo(locationImage.snp.right).offset(10)
        }
        locationBtn.titleLabel?.textAlignment = .left
        locationBtn.titleLabel?.font = .boldSystemFont(ofSize: 20)
        locationBtn.setTitleColor(.white, for: .normal)
        locationBtn.setTitle("考拉英语", for: .normal)
        locationBtn.titleLabel?.lineBreakMode = .byTruncatingTail
        
       
        let utilsBtn = UIButton()
        header.addSubview(utilsBtn)
        utilsBtn.setImage(UIImage(named: "ic_mycolloect"), for: .normal)
        utilsBtn.snp.makeConstraints { make in
            make.top.bottom.equalTo(header)
            make.width.equalTo(44)
            make.right.equalTo(header).offset(-10)
        }
        
        let tableView = UITableView()
        self.view.addSubview(tableView)
        tableView.delegate = self
        tableView.dataSource = self
        tableView.separatorStyle = .none
        tableView.snp.makeConstraints { make in
            make.left.right.bottom.equalTo(self.view)
            make.top.equalTo(header.snp.bottom).offset(10)
        }
        self.tableView = tableView
    }
}
